#include <QtGui/QApplication>
#include <QStatusBar>
#include <QLabel>
#include "GUIDemoMainLoop.h"
#include "GUIDemoWindow.h"
#include "WiiCIS.h"
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    GUIDemoWindow w;
    GUIDemoMainLoop * loop;
    w.show();

    bool useWM = false;
    WiiCIS::Wiimote * wm;
    try {
        wm = new WiiCIS::Wiimote();
        useWM = true;
        loop = new GUIDemoMainLoop(wm);
        loop->start();

        w.statusBar()->showMessage("Ready.");
    } catch (WiiCIS::WiiCISRadioNotFoundException & e) {
        w.notifyNoRadio();
    }
    a.connect(loop, SIGNAL(setButtons(WiiCIS::ButtonState)), &w, SLOT(setButtons(WiiCIS::ButtonState)));
    //w.statusBar()->addWidget(new QLabel("Ready."));

    return a.exec();
}
